
// ChildFrm.cpp : implementation of the CChildFrame class
//

#include "stdafx.h"
#include "Camino.h"

#include "ChildFrm.h"
#include "StockOrder.h"
#include "DefaultFormView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

// CChildFrame

IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWndEx)

BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWndEx)
END_MESSAGE_MAP()

// CChildFrame construction/destruction

CChildFrame::CChildFrame()
{
	// TODO: add member initialization code here
}

CChildFrame::~CChildFrame()
{
}


BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying the CREATESTRUCT cs
	if( !CMDIChildWndEx::PreCreateWindow(cs) )
		return FALSE;

	return TRUE;
}

void	CChildFrame::OpenDialog(int nType)
{
	CCreateContext* pContext = &m_ccData;
	UINT			nID = IDD_STOCKORDER;

	pContext->m_pNewViewClass = RUNTIME_CLASS(CStockOrder);

	CWnd* pView = (CWnd*)pContext->m_pNewViewClass->CreateObject();
	if (pView == NULL)
	{
		TRACE1("Warning: Dynamic create of view type %hs failed.\n",
			pContext->m_pNewViewClass->m_lpszClassName);
		return;
	}
	ASSERT_KINDOF(CWnd, pView);
	m_pView = (CView*)pView;
	if (!pView->Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
		CRect(0, 0, 0, 0), this, nID, pContext))
	{
		TRACE0("Warning: could not create view for frame.\n");
		return ;        // can't continue without a view
	}

	ModifyStyleEx(WS_EX_CLIENTEDGE, 0, SWP_FRAMECHANGED);

	CFormView*	pBaseView = NULL;
	pBaseView = (CFormView*)((CStockOrder*)m_pView);
	//m_pBaseView = pBaseView;

	if (pBaseView == NULL) return;
}
// CChildFrame diagnostics

#ifdef _DEBUG
void CChildFrame::AssertValid() const
{
	CMDIChildWndEx::AssertValid();
}

void CChildFrame::Dump(CDumpContext& dc) const
{
	CMDIChildWndEx::Dump(dc);
}
#endif //_DEBUG

// CChildFrame message handlers
